import { _decorator, Component, SpriteFrame, Animation } from "cc"
import { FSM_PARAMS_TYPE_ENUM, PARAMS_NAME_ENUM } from "../Enum"
import State from "./State";
import { StateMachine } from "./StateMachine";
const { ccclass, property } = _decorator;


export abstract class SubStateMachine {

  private _currenState: State = null;
  stateMachine: Record<string, State> = {}
  fsm: StateMachine // 父状态机

  constructor(fsm: StateMachine) {
    this.fsm = fsm
  }

  get currentState() {
    return this._currenState
  }

  set currentState(state: State) {
    this._currenState = state
    this._currenState.run()
  }

  isInState(state_name: string){
    return this.currentState === this.stateMachine[state_name]
  }

  abstract run(): void


}
